import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * @ClassName tr
 * @Description TODO
 * @Author HP
 * @Date 11:24 2022/7/11
 * @Version 1.0
 **/
public class tr {
    public static void main(String[] args) {
        Map<Integer,String> map =new HashMap<>();
        System.out.println(map.put(1,"aaa"));
        System.out.println(map.put(2,"bbb"));
        System.out.println(map.put(1,"ccc"));
        for (Integer key :map.keySet()){
            String value =map.get(key);
            System.out.println(key+"----"+value);

        }
        Iterator<Integer> it =map.keySet().iterator();
        while ((it.hasNext())){
            Integer key = it.next();
            String value =map.get(key);
            System.out.println(key+"----"+value);
        }
        for(Map.Entry<Integer,String> e:map.entrySet()){
            Integer key =e.getKey();
            String value =e.getValue();
            System.out.println(key + "----"+value);
        }
    }
}
